<?php
$company = new Company(); 
$action = 'insert';
if (isset ( $this->objectData )) {
	$action = 'update';
}
?>


<form method="POST" name="boo">
<p id="title">  <?php  echo $this->title; ?>  </p>
	<input type="hidden" name="actiontype" value="<?php echo $action;?>" />
	<input type="hidden" name="Car_id" id="car_id"
		value="<?php echo $this->bind('id')?>">
	<div class="elem">
		<label for="car_numberplate"> Numberplate </label> <input type="text"
			name="Car_numberplate" id="car_numberplate"
			value="<?php echo $this->bind('numberplate')?>">
	</div>
	<div class="elem">
		<label for="car_quantity"> Quantity</label> <input type="text"
			name="Car_quantity" id="car_quantity"
			value="<?php echo $this->bind('quantity')?>">
	</div>
	<div class="elem">
		<label for="car_company"> Company</label>
			<select name="Car_company" id="car_company">
				<?php		
					foreach ($this->relativeData as $entity) {
						if ($this->bind('company') == $entity['id'])
							echo '<option selected="selected" value="'.$entity['id'].'" >'.$entity['name'].'</option>';
						else
							echo '<option value="'.$entity['id'].'">'.$entity['name'].'</option>';
					}					
				?>
			</select>
	</div>
	<?php if($action=='insert')
		echo '<input type="hidden" name="Car_status" id="car_status" value="1">';
	?>
	<button type="submit" onclick="document.boo.submit()" style="display: none;">Save</button>
</form>
